package priv.mill.xml;
import java.util.Arrays;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

@Component
public class Package {

	private static final Logger logger = Logger.getLogger(Package.class);
	
	@Autowired
	private Environment env;
	
//	@Value("${name}")
//	@Value("#{2^3}")
//	@Value("#{'${name}'=='root' and '${pass}'=='123'}")
	@Value("#{cup.name}")
	private String brand;

	

//	@Autowired
	@Value("#{cup}")
	private Cup cup;

//	@Value("#{cup.name matches '\\d{15,}'?'玻璃杯':'咖啡杯'}")
//	@Value("#{'this is my info'[5]}")
	private String cupName;
	
//	@Value("#{T(System).getProperty('sun.jnu.encoding')}")
	@Value("#{T(Math).random()*100}")
	private String encoding;

	
	@Value("#{person.mayis.^[age > 3]}")
	private Mayi mayi;

	@Value("#{person.mayis.?[age > 3]}")
	private Mayi[] mayis;
	

	@Value("#{systemProperties['os.name']}")
	private String pro;




	@Override
	public String toString() {
		return "Package [env=" + env + ", brand=" + brand + ", cup=" + cup
				+ ", cupName=" + cupName + ", encoding=" + encoding + ", mayi="
				+ mayi + ", mayis=" + Arrays.toString(mayis) + ", pro=" + pro
				+ "]";
	}

















	public static void main(String[] args) {
		
		String property = System.getProperty("sun.jnu.encoding");
		
		System.out.println(property);
	}
	
	
	
	
}
